package com.physics.mps.common.config;

import com.physics.mps.common.config.properties.ApiProperties;
import io.minio.MinioClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

/**
 * @author mcsoft
 * @date 2023/12/15 15:11
 **/
@Configuration
public class MinioConfig {

    @Resource
    private ApiProperties apiProperties;

    /**
     * 获取 MinioClient
     *
     * @return
     */
    @Bean(name = "minioClient")
    public MinioClient minioClient() {
        return MinioClient.builder()
                .endpoint(apiProperties.getEndPoint())
                .credentials(apiProperties.getAccessKey(), apiProperties.getSecretKey())
                .build();
    }
}
